<?php
include('lib/db_connection.php');
$veh = $_GET["veh"];
$company_id = $_SESSION['company_id'];

$result_comp = mysql_query("SELECT * FROM company_tbl WHERE company_id='".$company_id."'")
or die("SELECT COMPANY ".mysql_error());
$row_comp = mysql_fetch_array($result_comp);

function commafy($_)
       {
        return strrev( (string)preg_replace( '/(\d{3})(?=\d)(?!\d*\.)/', '$1,' , strrev( $_ ) ) );
       }
?>
<html>
<head>
</head>
<body style='background-color:#FFFFFF' onLoad='window.print()'>
<table border='0' width='810' style='margin-left:auto;margin-right:auto;font-size:14px;font-family:Times New Roman'>
<tr>
 <th width='100%' style='text-align:center;' colspan='3'><?php echo $row_comp['company_name']?></th>
</tr>
<tr>
 <th width='100%' style='text-align:center;' colspan='3'><?php echo $row_comp['address']?></th>
</tr>
<tr>
 <td width='33%' style='text-align:left;'>Contact No:<?php echo $row_comp['contact_no']?></td>
 <td width='34%' style='text-align:center;'><?php echo $row_comp['website']?></td>
 <td width='33%' style='text-align:right;'>Fax No:<?php echo $row_comp['fax_no']?></td>
</tr>
</table>


<?php
$query_veh = "SELECT * FROM vehicle_tbl WHERE vehicle_id='".$veh."'";
$result_veh = mysql_query($query_veh);
$row_vehicles = mysql_fetch_array($result_veh);
?>
	<div style="width: 100%; text-align: center;"><img border="0" src="image/decommission_report.png" width="810" height="30" /></div>
	<table id='veh_info' border='0' width='810' style='margin-left:auto;margin-right:auto;font-size:14px;font-family:Times New Roman'>
	<tr>
	<td><b>Plate No:&nbsp;<?php echo $row_vehicles['veh_num']?></b></td>
	</tr>
 	<tr>
 	<td><b>Model:&nbsp;<?php echo $row_vehicles['manufacturer_name']?>&nbsp;<?php echo $row_vehicles['model_name']?>&nbsp;<?php echo $row_vehicles['year']?></b></td>
 	</tr>
	</table>



<div style="width: 100%; text-align: center;"><img border="0" src="image/decommission_history.png" width="810" height="23"/></div>
<table border='1' width='810' style='margin-left:auto;margin-right:auto;font-size:14px;font-family:Times New Roman'>
<tr>
	<th style='width:20%'>Start Date</th>
  <th style='width:20%'>End Date</th>
	<th style='width:60%'>Reason</th>
</tr>
<?php
$query_list = "SELECT * FROM veh_decommission WHERE veh_id='".$veh."' ORDER BY dec_date DESC";
$result_list = mysql_query($query_list) or die("LIST ".mysql_error());
while($row_list = mysql_fetch_array($result_list))
{
?>
<tr>
	<td style='text-align:center'><?php echo $row_list['dec_date']?></td>
  <td style='text-align:center'><?php echo $row_list['end_date']?></td>
	<td style='padding-left:10px;padding-right:10px;'><?php echo $row_list['reason']?></td>
</tr>
<?php
}
?>
</table>
<p style=" position: relative; bottom: 0; left: 0; width: 100%; text-align: center;"><img border="0" src="image/footer_wo.png" width="135" height="30" style='margin-left:auto;margin-right:auto'/></p>
</body>
</html>
